﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Buy2Site.Classes;
using Buy2Site.UserControls.ShoppingCart;

namespace Buy2Site.UserControls
{
    public partial class ShoppingCartTotalPrice : System.Web.UI.UserControl
    {
        public static double TotalItemsPrice { get; set; }
        //private double PriceOfAllSameItems = 0.0;

        protected void Page_Load(object sender, EventArgs e)
        {
            // ListOfAllQuantetiesItems
            // (ProductClass)Application["ListOfAllQuantetiesItems"]).ListOfAllQuantetiesItems
            if (Session["ListOfItems"] != null)
            {
                foreach (var item in ((ProductClass)Session["ListOfItems"]).ListOfItems)
                {
                    if (item.Title != "" && item.Title == ShoppingCartItem.ProductItem.Title)
                    {
                        TotalItemsPrice += ShoppingCartItem.PriceOfAllSameItems;
                    }
                    //totalItemsPrice += ShoppingCartItem.PriceOfAllSameItems;

                    //totalItemsPrice += item.Price;
                }
            }
        }
    }
}